/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine - graphics
// Copyright (c) 2014.  All Rights Reserved
//
// File:		AERenderNode.cpp
// Author:		Gianluca Belardelli
// Date:		13/06/2014
//
/////////////////////////////////////////////////////////////////////////
#include <AEEngine.h>

AE_DLLIMPEXP AERenderNode::AERenderNode( AERenderContext *lpTargetContext ) : AERenderContextContainer(),
																			m_bRenderingEnabled( 1 ),
																			m_bIsInitialized( 0 ),
																			m_fPixelAspectRatio( AEngine::GetDefaultVideoConfig()->GetPixelAspectRatio() )
{
	m_lpFinalTargetContext = lpTargetContext;
}

AE_DLLIMPEXP AERenderNode::~AERenderNode( void )
{
}

AE_DLLIMPEXP void AERenderNode::Execute( void )
{
	if( !GetRenderingEnabled() )
		return;

	AEASSERT_MSG( IsInitialized(), "Il RenderNode deve essere inizializzato prima di poter renderizzare.");

	RenderContexts( -FLT_MAX, FLT_MAX );
}

AE_DLLIMPEXP AEBOOL32 AERenderNode::SetVariable( const char *lpName, const char *lpValue )
{
	return 0;
}

AE_DLLIMPEXP void AERenderNode::BeginPropertyUpdate( void )
{
}

AE_DLLIMPEXP void AERenderNode::EndPropertyUpdate( void )
{
}

AE_DLLIMPEXP void AERenderNode::InitializeRenderer( void )
{
	m_bIsInitialized = AETRUE;
}

AE_DLLIMPEXP void AERenderNode::DeInitializeRenderer( void )
{
	m_bIsInitialized = AEFALSE;
}

AE_DLLIMPEXP void AERenderNode::ReInitializeRenderer( void )
{
	if( !IsInitialized() )
	{
		InitializeRenderer();
	}
	else
	{
		DeInitializeRenderer();
		InitializeRenderer();
	}
}

AE_DLLIMPEXP void AERenderNode::SetRenderingEnabled( AEBOOL32 bStatus )
{
	m_bRenderingEnabled = bStatus;
}
